{include file="index/header" /}
<link rel="stylesheet" href="__PUBLIC__editor/css/editormd.css"/>
<script src="__PUBLIC__editor/editormd.js"></script>
<style type="text/css">
	.answer_radio{margin-left: 20px;display: block;float: left;line-height: 41px;}
</style>
<div class="panel admin-panel margin-top" id="add">
	<div class="panel-head"><strong><span class="icon-pencil-square-o"></span> 增加内容/{$choices}</strong></div>
	<div class="body-content">
		<form method="post" class="form-x" action="" onkeydown="if(event.keyCode==13){return false;}" onsubmit="return checkRadio()">
			<div class="form-group">
				<div class="label">
					<label>选择：</label>
				</div>
				<div class="field">
					<select name="nav_id" class="input w50"  id="nav" data-validate="required:请选择专业">
						<option value="">请选择专业</option>
						{foreach $nav_data as $nav}
						<option value="{$nav.nav_id}" {if $data.nav_id eq $nav.nav_id}selected{/if}>{$nav.nav_name}</option>
						{/foreach}
					</select>  
					<select name="type_id" class="input w50" id="type" data-validate="required:请选择阶段">
						<option value="">请选择阶段</option>
						{foreach $type_data as $type}
						<option value="{$type.type_id}" {if $data.type_id eq $type.type_id}selected{/if}>{$type.type_name}</option>
						{/foreach}
					</select>
					<select name="s_id" class="input w50" id="s" data-validate="required:请选择章节">
						<option value="">请选择章节</option>
						{foreach $s_data as $s}
						<option value="{$s.s_id}" {if $data.s_id eq $s.s_id}selected{/if}>{$s.s_name}</option>
						{/foreach}
					</select>
					<select name="course_id" class="input w50" id="course" data-validate="required:请选择课程">
						<option value="">请选择课程</option>
						{foreach $course_data as $course}
						<option value="{$course.course_id}" {if $data.course_id eq $course.course_id}selected{/if}>{$course.course_name}</option>
						{/foreach}
					</select>
					<div class="tips"></div>
				</div>
			</div>
			<div class="form-group">
				<div class="label">
					<label>定位视频节点：</label>
				</div>
				<div class="field">
					<input name="seek" type='number'  class="input w50" value="{$data.seek ?: 0}" data-validate="required:请输入标题" />
					<div class="tips"></div>
				</div>
			</div>
			<div class="form-group">
				<div class="label">
					<label>题干/标题：</label>
				</div>
				<div class="field">
					<div id="test-editormd">
						<textarea name="stem" style="display:none;" id="ts">{$data.stem}</textarea>
					</div>
					<div class="tips"></div>
				</div>
			</div>
			{if $data}{foreach $data.choices as $key=>$v}
			<div class="form-group">
				<div class="label">
					<label class="labelCommon label{$v.zimu}">选项{$v.zimu}：</label>
				</div>
				<div class="field">
					<input type="text" class="input w50" name="choices[]" value="{$v.content}" {if $key <= 1}data-validate="required:请输入内容"{/if} />
					<div class="tips"></div>
					<label class="answer_radio"><input type="radio"  name="answer[]" value="{$key}" {in name="$key" value="$data.answer"} checked="" {/in}>正确答案</label>
				</div>
			</div>
			{/foreach}{else}
			<div class="form-group">
				<div class="label">
					<label class="labelCommon labelA">选项A：</label>
				</div>
				<div class="field">
					<input type="text" class="input w50" name="choices[]"  data-validate="required:请输入内容" />
					<div class="tips"></div>
					<label class="answer_radio"><input type="radio" name="answer[]" value="0">正确答案</label>
				</div>
			</div>
			<div class="form-group">
				<div class="label">
					<label class="labelCommon labelB">选项B：</label>
				</div>
				<div class="field">
					<input type="text" class="input w50" name="choices[]" />
					<div class="tips"></div>
					<label class="answer_radio"><input type="radio" name="answer[]" value="1">正确答案</label>
				</div>
			</div>
			<div class="form-group">
				<div class="label">
					<label class="labelCommon labelC">选项C：</label>
				</div>
				<div class="field">
					<input type="text" class="input w50" name="choices[]" />
					<div class="tips"></div>
					<label class="answer_radio"><input type="radio" name="answer[]" value="2">正确答案</label>
				</div>
			</div>
			<div class="form-group choiceD">
				<div class="label">
					<label class="labelCommon labelD">选项D：</label>
				</div>
				<div class="field">
					<input type="text" class="input w50" name="choices[]" />
					<div class="tips"></div>
					<label class="answer_radio"><input type="radio" name="answer[]" value="3">正确答案</label>
				</div>
			</div>
			{/if}
			<div class="form-group">
				<div class="label">
					<label>解析：</label>
				</div>
				<div class="field">
					<div id="test-editormd1">
						<textarea name="analysis" style="display:none;" id="ts">{$data.analysis}</textarea>
					</div>
					<div class="tips"></div>
				</div>
			</div>
			<div class="form-group">
				<div class="label">
					<label>掌握点：</label>
				</div>
				<div class="field">
					<input type="number" class="input w50" name="points" value="{$data.points ?: 1}"  data-validate="required:,number:掌握点必须为数字" />
					<div class="tips"></div>
				</div>
			</div>
			<div class="form-group">
				<div class="label">
					<label></label>
				</div>
				<div class="field">
					<button class="button bg-main icon-check-square-o" type="submit"> 提交</button>
				</div>
			</div>
		</form>
	</div>
</div>
<script type="text/javascript" src="__PUBLIC__admin/select.js?v=1.0.0"></script>
<script type="text/javascript">
	var testEditor;
	testEditor = editormd("test-editormd", {
		height  : 640,
		syncScrolling : "single",
		path    : "/public/editor/lib/",
		saveHTMLToTextarea : true,//注意3：这个配置，方便post提交表单
		/**上传图片相关配置如下*/
		imageUpload : true,
		imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
		imageUploadURL : "/editor/uploads",//注意你后端的上传图片服务地址
	});
	testEditor = editormd("test-editormd1", {
		height  : 640,
		syncScrolling : "single",
		path    : "/public/editor/lib/",
		saveHTMLToTextarea : true,//注意3：这个配置，方便post提交表单
		/**上传图片相关配置如下*/
		imageUpload : true,
		imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
		imageUploadURL : "/editor/uploads",//注意你后端的上传图片服务地址
	});
</script>